import Vue from "vue";
import Router from "vue-router";
import Layout from "@/layout/layout";
Vue.use(Router);

/* 
* 路由元信息
title:tags 标签名 默认'no-title'
noCache :是否缓存 ，默认 false

*/
export default new Router({
  mode: "history",
  base: process.env.BASE_URL,
  routes: [
    {
      path: "",
      component: Layout,
      children: [
        {
          path: "/",
          component: () =>
            import(/* webpackChunkName: "home" */ "./views/Home.vue"),
          name: "Home",
          meta: { title: "Home" }
        },
        {
          path: "/about",

          component: () =>
            import(/* webpackChunkName: "about" */ "./views/About.vue"),
          name: "About",
          meta: { title: "About" }
        },
        {
          path: "/other",
          component: () =>
            import(/* webpackChunkName: "other" */ "./views/Other.vue"),
          name: "Other",
          meta: { title: "Other" }
        }
      ]
    },
    {
      path: "/login",
      name: "login",
      component: () =>
        import(/* webpackChunkName: "login" */ "./views/login.vue")
    },
    {
      path: "*",
      name: "error",
      component: () => import(/* webpackChunkName: "error" */ "./views/404.vue")
    }
  ]
});
